// 以后这个文件专门封装跟员工有关的接口
import request from '@/utils/request'

// 获取员工的基本信息
export const profile = (id) => {
  return request({
    url: `/sys/user/${id}`
  })
}

// 获取员工简单列表
export const simpleListAPI = () => {
  return request({
    url: '/sys/user/simple'
  })
}

// 获取员工列表
export const empListAPI = (params) => {
  return request({
    url: '/sys/user',
    params
  })
}

// 删除员工
export const delEmpAPI = (id) => {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

// 新增员工
export const addEmpAPI = (data) => {
  return request({
    url: `/sys/user`,
    method: 'post',
    data
  })
}

// 批量导入员工
export const batchEmpAPI = (data) => {
  return request({
    url: `/sys/user/batch`,
    method: 'post',
    data
  })
}

// 封装保存员工基本信息的接口
export const setProfileAPI = (data) => {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })
}

// 封装获取员工个人信息的接口
export const personalInfoAPI = (id) => {
  return request({
    url: `/employees/${id}/personalInfo`
  })
}

// 封装保存员工个人信息的接口
export const setPersonalInfoAPI = (data) => {
  return request({
    url: `/employees/${data.id}/personalInfo`,
    method: 'put',
    data
  })
}

// 封装获取员工岗位信息的接口
export const jobInfoAPI = (id) => {
  return request({
    url: `/employees/${id}/jobs`
  })
}

// 封装给员工分配角色的接口
export const assignRole = (data) => {
  return request({
    url: `/sys/user/assignRoles`,
    method: 'put',
    data
  })
}
